import http from '@/http/http'
import { LoginParm, LoginResult, UserInfo } from './userModel'
enum Api {
  getImg = '/api/sysUser/image',
  login = '/api/user/login',
  getInfo = '/api/sysUser/getInfo',
  getLeftTree = '/api/department/list',
  getUserList = '/api/user/list',
  addAndEdit = '/api/user',
  getRoleList = '/api/user/getRolistForAssign',
  getRoleId = '/api/user/getRoleIdByUserId',
  assignSave = '/api/user/assingRole',
  loginOut = '/api/sysUser/loginOut',
  restore = '/api/backup/restore'
}
//获取验证码
export async function getImagApi() {
  return await http.getImage(Api.getImg)
}
//登录
export async function loginApi(params: LoginParm) {
  return await http.login<LoginResult>(Api.login, params)
}
//获取用户信息
export const getInfoApi = async () => {
  return await http.get<UserInfo>(Api.getInfo)
}
